<?php

namespace Website\Modules\Frontend\Controllers;

use Phalcon\Logger;
use Phalcon\Logger\Adapter\File as FileAdapter;
use Website\Hlog;



class Test1Controller extends ControllerBase
{

    public function indexAction()
    {

    }


    public function testlogAction()
    {
//        var_dump($this->request->getURI());
//        var_dump(APP_PATH);
        $logger = new FileAdapter(APP_PATH."/logs/test.log");
        $data = [
            'id'=>123,
            'name'=>'name'
        ];

        $logger->debug("it is : ". print_r($data,true));
    }


    public function testAction()
    {
        var_dump('hello');
    }

    //使用namespace调用
    public function t1Action()
    {
        $Hlog = new Hlog();
        $r=$Hlog->test1();
        var_dump($r);
    }

    //使用di注入调用
    public function dit2Action()
    {
        var_dump($this->Hlog->test2());
    }

    public function t3Action()
    {
        var_dump($this->Hlog->action());
    }

    public function t3sAction()
    {
        var_dump(Hlog::action());
    }
}

